a=int(input())
one=two=three=four=six=0
o=["a"]*a
i=0
for i in range (a):
b=input()
c=list(b)
for j in range (6):
if c[j]==c[j+6]=="X":
six=1
break
else:
six=0
j=j+1
for j in range (4):
if c[j]==c[j+4]==c[j+8]=="X":
four=1
break
else:
four=0
j=j+1
for j in range (3):
if c[j]==c[j+3]==c[j+6]==c[j+9]=="X":
three=1
break
else:
three=0
j=j+1
for j in range (2):
if c[j]==c[j+2]==c[j+4]==c[j+6]==c[j+8]==c[j+10]=="X":
two=1
break
else:
two=0
j=j+1
for j in range (1):
if c[j]==c[j+1]==c[j+2]==c[j+3]==c[j+4]==c[j+5]==c[j+6]==c[j+7]==c[j+8]==c[j+9]==c[j+10]==c[j+11]=="X":
one=1
break
elif c[j]==c[j+1]==c[j+2]==c[j+3]==c[j+4]==c[j+5]==c[j+6]==c[j+7]==c[j+8]==c[j+9]==c[j+10]==c[j+11]=="O":
one=two=three=four=six=2
else:
one=0
if one==1:
o[i]="6 1x12 2x6 3x4 4x3 6x2 12x1"
elif two==1 and three==1 and four==1 and six==1:
o[i]="5 1x12 2x6 3x4 4x3 6x2"
elif two==1 and four==1 and six==1 and three==0:
o[i]="4 1x12 2x6 3x4 6x2"
elif three==1 and four==1 and six==1 and two==0:
o[i]="4 1x12 2x6 3x4 4x3"
elif three==1 and six==1 and two==0 and four==0:
o[i]= "3 1x12 2x6 4x3"
elif two==1 and three==0 and four==1 and six==0:
o[i]= "3 1x12 3x4 6x2"
elif two==0 and three==0 and four==1 and six==0:
o[i]= "2 1x12 3x4"
elif two==0 and three==0 and four==1 and six==1:
o[i]= "3 1x12 2x6 3x4"
elif two==0 and three==0 and four==0 and six==1:
o[i]= "2 1x12 2x6"
elif two==0 and three==0 and four==0 and six==0:
o[i]= "1 1x12"
elif two==2 and three==2 and four==2 and six==2:
o[i]="0"
else:
o[i]= "miscalculated"
for i in range (a):
print( o[i] )
189A - Cut Ribbon | 1182A - Filling Shapes |
82A - Double Cola | 45A - Codecraft III |
1242A - Tile Painting | 1663E - Are You Safe |
1663D - Is it rated - 3 | 1311A - Add Odd or Subtract Even |
977F - Consecutive Subsequence | 939A - Love Triangle |
755A - PolandBall and Hypothesis | 760B - Frodo and pillows |
1006A - Adjacent Replacements | 1195C - Basketball Exercise |
1206A - Choose Two Numbers | 1438B - Valerii Against Everyone |
822A - I'm bored with life | 9A - Die Roll |
1430B - Barrels | 279B - Books |
1374B - Multiply by 2 divide by 6 | 1093B - Letters Rearranging |
1213C - Book Reading | 1468C - Berpizza |
1546B - AquaMoon and Stolen String | 1353C - Board Moves |
902A - Visiting a Friend | 299B - Ksusha the Squirrel |
1647D - Madoka and the Best School in Russia | 1208A - XORinacci |